package xyz.xtt.asset.vo;

import java.util.Objects;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author huqibo
 * @date 2024/12/28
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SendElementResult {
	private int currIndex;
	private Boolean result;
	private Long accountNo;
	private TransferFromResult transferFromResult;

	public static SendElementResult buildFail() {
		return SendElementResult.builder().result(Boolean.FALSE).build();
	}

	public static SendElementResult buildSucc(int currIndex, Long accountNo, TransferFromResult transferFromResult) {
		return SendElementResult.builder().result(Boolean.TRUE).accountNo(accountNo).transferFromResult(transferFromResult).currIndex(currIndex).build();
	}

	public boolean isOk() {
		return Objects.nonNull(result) && Objects.equals(result, Boolean.TRUE);
	}
}
